package cn.threewaters.qtyy.web.controller.business;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.threewaters.qtyy.common.bean.ResponseJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "字典")
@Controller
@RequestMapping(value = "/dict")
public class DictController {

	@Resource
	@Qualifier("oneJdbcTemplate")
	private JdbcTemplate oneJdbcTemplate;

	@ApiOperation(value = "字典项")
	@RequestMapping(value = "/cangfang", method = RequestMethod.GET)
	@ResponseBody
	public ResponseJson getCangfang(String orgcode) throws Exception {
		List<Map<String, Object>> queryForList = oneJdbcTemplate.queryForList(
				"select housecode as realValue,housename as displayValue from la_storehouse where orgcode = '" + orgcode
						+ "' order by 1");
		return ResponseJson.builder().success(true).obj(queryForList).build();
	}

}
